package com.atguigu.practice;

import java.util.Scanner;

public class LevelUp {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNextInt()){
            int n=scanner.nextInt(); //怪的数量
            int initial=scanner.nextInt(); //初始能力值
            int[] defend=new int[n]; //存放怪的防御力的数组
            for(int i=0;i<n;i++){
                defend[i]=scanner.nextInt();
            }
            int current=initial;
            for(int i=0;i<n;i++){
                if(current>=defend[i]){
                    current+=defend[i];
                }else{
                    int divisor=findTheMostCommonDivisor(current,defend[i]);
                    current+=divisor;
                }
            }
            System.out.println(current);
        }
    }

    private static int findTheMostCommonDivisor(int m, int n) {
        if(m%n==0){
            return n;
        }else{
            return findTheMostCommonDivisor(n,m%n);
        }
    }
}
